package com.hxzy.config;

import com.hxzy.service.SysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;


/**
 * 自定义初始化系统资源
 */
@Configuration
public class InitPostDataConfig {

    // @Resource(name = "sysDictDataServiceImpl")  等于 @Autowired+ @Qualifier(value = "sysDictDataServiceImpl")
    @Autowired
    private SysDictDataService sysDictDataService;

    /**
     * 初始化调用
     */
    @PostConstruct
    public void init(){
        //清空所有字典的key
        this.sysDictDataService.clearDictDataToRedis();
        //加载字典的值
        this.sysDictDataService.loadAllDictDataToRedis();
    }


}
